package com.chixing.day13.day13_Home;

import java.util.Objects;

public class Product {
    private int productId;
    private String productName;
    private double productprice;

    public Product() {
    }

    public Product(int productId, String productName, double productprice) {
        this.productId = productId;
        this.productName = productName;
        this.productprice = productprice;
    }

    public int getProductId() {
        return productId;
    }

    public void setProductId(int productId) {
        this.productId = productId;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public double getProductprice() {
        return productprice;
    }

    public void setProductprice(double productprice) {
        this.productprice = productprice;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {return true;}
        if (o == null || getClass() != o.getClass()){ return false;}
        Product product = (Product) o;
        return productId == product.productId && Double.compare(product.productprice, productprice) == 0 && Objects.equals(productName, product.productName);
    }

    @Override
    public String toString() {
        return "商品类表: " + "\n"+
                " " + " " +"商品ID: " + productId + "\n" +
                " " + " " +"商品名称: " + productName + "\n" +
                " " + " " +"商品价格: " + productprice + "\n" ;
    }

    @Override
    public int hashCode() {
        return Objects.hash(productId, productName, productprice);



    }
}
